<!--#include file="Config.asp"-->
<!--#include file="emp_is.asp"-->
<!--#include file="Header.asp"-->

<%
intID=int(Request("id"))
SaveType=Trim(request("SaveType"))
set rs=server.createobject("adodb.recordset")


'SaveAdd
if SaveType="AddOK" And request("topic")<>"" then
sql="select * from basic_todo where id is null"
rs.open sql,conn,1,3
rs.addnew
rs("topic")=Trim(Request("topic"))
rs("begintime")=Now()
rs("finishtype")=0
rs.Update
rs.close
response.redirect Request.ServerVariables("Http_referer")
end if

'SaveMod
if SaveType="ToDoOK" and intID<>"" then
sql="select * from basic_todo where id="&IntID
rs.open sql,conn,1,3
rs("finishtime")=Now()
rs("finishtype")=1
rs.Update
rs.close
response.redirect Request.ServerVariables("Http_referer")
end if
%>
<table class="table table-condensed table-hover table-bordered">
<FORM METHOD=POST ACTION="?SaveType=AddOK">
<TR>
<Th>
Topic：<INPUT TYPE="text" NAME="topic" size='100'>
<INPUT TYPE="submit" value='增加待办'>
</TD>
</TR>
</FORM>
</TABLE>

<table class="table table-condensed table-hover table-bordered">
<TR>
	<Th>ID</Th>
	<Th>Topic</Th>
    <Th>Admin</Th>
	<Th>Time</Th>
</TR>
<%
sql="select * from basic_todo order by finishtype,begintime"
rs.open sql,conn,1,1
If rs.recordcount<>0 then
   rs.PageSize =page_num_max_per*2
   Page = CLng(Request("Page"))
   If Page < 1 Then Page = 1
   If Page > rs.PageCount Then Page = rs.PageCount
   PageBegin=rs.PageSize*(Page-1)+1
  if rs.PageSize*PageN< rs.RecordCount then
    PageEnd=rs.PageSize * Page
  else
    PageEnd=rs.RecordCount
  end If
  maxpage=rs.pagecount
  rcount=rs.RecordCount
rs.AbsolutePage = Page
For iPage = 1 To rs.PageSize
%>
<tr style="cursor:hand" <%If rs("finishtype")=1 then%>bgCOLOR="#FFFFCC"
	<%else%>onmouseover="this.bgColor='#f6f6f6';" onmouseout="this.bgColor='';" <%End if%>>
	<TD ><%=int(rs("id"))%></TD>
	<TD ><%If rs("finishtype")=0 then%><%=trim(rs("topic"))%><%else%><s><I><%=trim(rs("topic"))%></I></s><%End if%></TD>
	<TD >
	<%If rs("finishtype")=0 then%><A HREF="?SaveType=ToDoOK&ID=<%=int(rs("id"))%>"title='点击关闭此待办事宜'>点击关闭</A>
	<%else%>
	<FONT size=1 COLOR="#CC0000"><I><s><%=rs("finishtime")%>&nbsp;完成</s></I></FONT>
	<%End if%>
	</TD>
	<TD >
	<FONT COLOR="#CCCCCC"><%=int(rs("id"))%>.<%=rs("begintime")%>.<%=weekdayname(weekday(rs("begintime")))%></FONT></TD>
</tr>
<%
rs.MoveNext
If rs.EOF Then Exit For
Next
End if
rs.close
%>
<tr><th colspan='6' >

<%
  response.write "" & rcount & "/" & maxpage & ",当前显示<font color=red>第" & Page & "页</font>[<font color=red>第" & PageBegin & "条-第" & PageEnd & "条</font>]"%>
<%=Page%>/<%=maxpage%>
<%If Page <> 1 Then ' 如果不是位于第一页 %>
     <A HREF='?Page=1'>[首页]</A>
     <A HREF='?Page=<%=(Page-1)%>'>[上页]</A>
<%End If
  If Page <> maxpage Then ' 如果不是位于最后一页
%>
  <A HREF='?Page=<%=(Page+1)%>'>[下页]</A>
  <A HREF='?Page=<%=maxpage%>'>[末页]</A>
<%End If%>
</FONT>
</td>
</tr>
</TABLE>
<!--#include file="Footer.asp" -->
